package com.heima.wemedia.controller.v1;

import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.dtos.SensitiveDto;
import com.heima.model.wemedia.pojos.WmSensitive;
import com.heima.wemedia.service.WmSensitiveService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/v1/sensitive")
public class WmSensitiveController{

	@Autowired
	private WmSensitiveService wmSensitiveService;

	/**
	 * 新增敏感词
	 * @param wmSensitive
	 * @return
	 */
	@PostMapping("/save")
	public ResponseResult insert(@RequestBody WmSensitive wmSensitive){
		return wmSensitiveService.insert(wmSensitive);
	}

	/**
	 * 查询敏感词列表
	 * @param sensitiveDto
	 * @return
	 */
	@PostMapping("/list")
	public ResponseResult list(@RequestBody SensitiveDto sensitiveDto){
		return wmSensitiveService.list(sensitiveDto);
	}

	/**
	 * 修改敏感词
	 * @param wmSensitive
	 * @return
	 */
	@PostMapping("/update")
	public ResponseResult update(@RequestBody WmSensitive wmSensitive){
		return wmSensitiveService.update(wmSensitive);
	}

	/**
	 * 删除敏感词
	 * @param id
	 * @return
	 */
	@DeleteMapping("/del/{id}")
	public ResponseResult delete(@PathVariable Integer id){
		return wmSensitiveService.delete(id);
	}
}
